<admintpl file="header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:U('Examine/xu_list')}">续期列表</a></li>
			<li class="active"><a>审核</a></li>
		</ul>
        <form class="form-horizontal js-ajax-form" action="{:U('Examine/xu_act')}" method="post">
			<fieldset>
				<div class="tabbable">
					<div class="tab-content">
						
							<fieldset>
								<div class="control-group">
									<label class="control-label">订单号</label>
									<div class="controls">
										<label class="control-label" style="width:auto">{$order.order_id}</label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">借款金额</label>
									<div class="controls">
										<label class="control-label" style="width:auto">{$order.order_amount}</label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">姓名</label>
									<div class="controls">
										<php>$ds=array('0'=>'<span style="color:red">未认证</span>','1'=>'<span style="color:green">已认证</span>','2'=>'<span style="color:red">认证未通过</span>','3'=>'<span style="color:red">暂时不需要</span>')</php>
										<label class="control-label" style="width:auto">{$order.name}<span class="form-required"> *  状态 
										{$ds[$order['account_status']]}</span></label>
										
										<input type="hidden" name="options[id]" value="{$order.id}">
										<input type="hidden" name="options[user_id]" value="{$order.user_id}">
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">手机号码</label>
									<div class="controls">
										<label class="control-label" style="width:auto">{$order.mobile}</label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">借款到期时间</label>
									<div class="controls">
										<label class="control-label" style="width:auto">{$order.order_endtime}</label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">续期金额</label>
									<div class="controls">
										<label class="control-label" style="width:auto">{$order.amount}</label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">续期信息</label>
									<div class="controls">
										<label class="control-label" style="width:auto">{$st}  {$order.renewal}</label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">续期天数</label>
									<div class="controls">
										<php>$day=(strtotime($order['endtime'])-strtotime(date('Y-m-d',strtotime($order['crtime']))))/(24*60*60)</php>
										<label class="control-label" style="width:auto">{$day}天</label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">申请时间</label>
									<div class="controls">
										<label class="control-label" style="width:auto">{$order.crtime}</label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">续期时间</label>
									<div class="controls">
										<label class="control-label" style="width:auto">{$order.endtime}</label>
									</div>
								</div>
								<if condition="($log)">
								<div class="control-group">
									<label class="control-label">审核信息</label>
									<div class="controls">
									<label class="control-label" style="width:auto">
										<!--<table border="1" style='text-align:center;width:800px' cellpadding='10px'>-->
										<table class="table table-bordered">
											<tr>
												<th>审核类型</th>
												<th>审核时间</th>
												<th>审核人</th>
												<th>收款人</th>
												<th>审核备注</th>
												<th>金额</th>
												<th>实收金额<br/>(不含逾期费)</th>
												<th>实收逾期费</th>
												<th>微信实收</th>
												<th>支付宝实收</th>
												<th>银行实收</th>
												<th>审核操作</th>
												<th>期数</th>
											</tr>
											<php>$stag=substr($order['stages'], 1);
											if(empty($stag)){
												$st='第1期'.$order['stages'].'次续期';
											}else{
												$stages=substr($order['stages'],0, 1);
												$st='第'.$stages.'期'.$stag.'次续期';
											}
											</php>
											<php>$stu_type=array('1'=>'借款中','2'=>'已还款','3'=>'逾期','4'=>'已到期','5'=>'审核中','6'=>'审核不通过','7'=>'驳回','8'=>'放款成功','9'=>'放款不成功','10'=>'待放款');
											$stu_ty=array('0'=>'用户审核','1'=>'订单审核','2'=>'用户信息审核','3'=>'续期审核','4'=>'逾期还款(本金)','5'=>'逾期还款','6'=>'订单审核','7'=>'客户还款');
											</php>
											<foreach name="log" item="vo">
												<neq name="vo.types" value="2">
												<tr>
													<td>{$stu_ty[$vo['types']]}</td>
													<td>{$vo.crtime}</td>
													<td>{$users[$vo['examine_id']]|default='系统'}</td>
													<td>{$users[$vo['payee']]}</td>
													<td>{$vo.message}</td>
													<td>{$vo.amount}</td>
													<td>{$vo.wechat_amount}</td>
													<td>{$vo.alipay_amount}</td>
													<td>{$vo.bank_amount}</td>
													<td>{$vo.real_amount|default='0.00'}</td>
													<td>{$vo.overdue_amount|default='0.00'}</td>
													<td>{$vo['status']?'审核成功':'审核失败'}</td>
													<td>
													<if condition="$vo['types'] eq 5">
													<php>
														$stag=substr($vo['stages'], 1);
														if(empty($stag)){
															$st='第'.$vo['stages'].'期1次';
														}else{
															$stages=substr($vo['stages'],0, 1);
															$st='第'.$stages.'期'.$stag.'次';
														}
													</php>
													{$st}
													<else />
													</if>
													</td>
												</tr>
												</neq>
											</foreach>
										</table>
									</label>
									</div>
								</div>
								</if>
								<if condition="($orther)">
								<div class="control-group">
									<label class="control-label">续期信息</label>
									<div class="controls">
									<label class="control-label" style="width:auto">
										<!--<table border="1" style='text-align:center;width:800px' cellpadding='10px'>-->
										<table class="table table-bordered">
											<tr>
												<th>订单号</th>
												<th>申请时间</th>
												<th>续期信息</th>
												<th>续期金额</th>
												<th>审核人</th>
												<th>审核备注</th>
												<th>审核状态</th>
											</tr>
											<foreach name="orther" item="vo">
												<tr>
													<td>{$vo.order_id}</td>
													<td>{$vo.crtime}</td>
													<td>{$vo.renewal}</td>
													<td>{$vo.amount}</td>
													<td>{$users[$vo['lastuser_id']]|default='系统'}</td>
													<td>{$vo.message}</td>
													<td>{$vo['status']==1?'审核成功':'审核失败'}</td>
												</tr>
											</foreach>
										</table>
									</label>
									</div>
								</div>
								</if>
						
								<div class="control-group">
									<label class="control-label">审核备注</label>
									<div class="controls"><textarea name="options[messgae]" rows="4" cols="30"></textarea><span class="form-required">30字以内</span></div>
								</div>
							</fieldset>
					</div>
				</div>

				<div class="form-actions">
					<button class="btn btn-primary js-ajax-submit" type="submit" data-types='1' data-action="{:U('Examine/xu_act',array('display'=>1))}" data-msg='审核确定通过?' data-subcheck="true">审核通过</button>
					<button class="btn btn-primary js-ajax-submit" type="submit" data-types='0' data-msg='审核确定不通过?' data-subtype='true' data-subcheck="true">审核不通过</button>
				</div>
			</fieldset>
		</form>
		
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
</body>
<script type="text/javascript">
	var ajaxForm_list = $('form.js-ajax-form');
	if (ajaxForm_list.length) {
	    Wind.use('ajaxForm', 'artDialog', function () {
			
	        $('button.js-ajax-submit').bind('click', function (e) {

	            e.preventDefault();
	            /*var btn = $(this).find('button.js-ajax-submit'),
						form = $(this);*/
	            var btn = $(this),
	                form = btn.parents('form.js-ajax-form');
	
	            //批量操作 判断选项
	            if (btn.data('subcheck')) {
	                btn.parent().find('span').remove();
					var msg = btn.data('msg');
					if (msg) {
						art.dialog({
							id: 'warning',
							icon: 'warning',
							content: btn.data('msg'),
							cancelVal: "{:L('CLOSE')}",
							cancel: function () {
								
							},
							button :[ {
											name : "{:L('OK')}",
											callback:function(){
												ajaxSubmit(btn.data('types'));
											},
											focus : true
									} ]
						});
					} else {
						btn.data('subcheck', false);
						btn.click();
					}
	                return false;
	            }
	        });
	
	    });
	}
	function ajaxSubmit(type){
			var btn = $('button.js-ajax-submit'),
			form = btn.parents('form.js-ajax-form');
			form.ajaxSubmit({
	                url: type ? btn.data('action') : form.attr('action'),
	                //按钮上是否自定义提交地址(多按钮情况)
	                dataType: 'json',
	                beforeSubmit: function (arr, $form, options) {
						var tx=type ? '审核通过' : '审核不通过';
	                    //按钮文案、状态修改
	                    btn.text(tx + '中...').attr('disabled', true).addClass('disabled');
	                },
	                success: function (data, statusText, xhr, $form) {
	                    //按钮文案、状态修改
	                    btn.removeClass('disabled').parent().find('span').remove();
	
	                    if (data.state === 'success') {
	                        $('<span class="tips_success">' + data.info + '</span>').appendTo(btn.parent()).fadeIn('slow').delay(1000).fadeOut(function () {
	                            if (data.referer) {
	                                //返回带跳转地址
	                                if (window.parent.art) {
	                                    //iframe弹出页
	                                    window.parent.location.href = data.referer;
	                                } else {
	                                    window.location.href = data.referer;
	                                }
	                            } else {
	                                if (window.parent.art) {
	                                    reloadPage(window.parent);
	                                } else {
	                                    //刷新当前页
	                                    reloadPage(window);
	                                }
	                            }
	                        });
	                    } else if (data.state === 'fail') {
	                        $('<span class="tips_error">' + data.info + '</span>').appendTo(btn.parent()).fadeIn('fast');
	                        btn.removeProp('disabled').removeClass('disabled');
	                    }
	                }
	            });
	}
	function ck(){
		var id=$("#amount").val();
		switch (id){
			<foreach name="amount_list" item="vo">
				case '{$vo.id}':
				document.getElementById('zxf').value='{$vo.interest}元';
				document.getElementById('shf').value='{$vo.examine}元';
				document.getElementById('gwf').value='{$vo.consulting}元';
				document.getElementById('dqf').value="{$vo['amount']}元";
				break;
			</foreach>
		}
	}
	function fel(){
		var id=$("#days").val();
		$("#stages").find("option[value='"+id+"']").attr("selected",true); 
	}
	function fels(){
		var id=$("#stages").val();
		$("#days").find("option[value='"+id+"']").attr("selected",true); 
	}
	</script>
</html>